﻿Imports DARSClassLibrary

Public Class studentViewAppointments
    Inherits System.Web.UI.Page
    Dim ws As DO_NOT_MOVE_ME_FROM_THIS_PROJECT.DARSWebservice
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Check if user is logged in
        If Session("CurrentUser") Is Nothing Then
            Response.Redirect("NotLoggedIn.aspx")
            Exit Sub
        End If
        If Not IsPostBack Then
            view()
        End If
    End Sub

    
    Public Sub view()
        ws = New DO_NOT_MOVE_ME_FROM_THIS_PROJECT.DARSWebservice
        Session("Pxy") = ws
        Dim objStudent As Student = CType(Session("CurrentUser"), Student)
        Dim ds As DataSet = ws.getStudentAppointments(objStudent.studentID)
        Dim objdv As New DataView(ds.Tables(0))
        gvOutput.DataSource = objdv
        gvOutput.DataBind()
    End Sub
    Protected Sub logout(ByVal sender As Object, ByVal e As EventArgs) Handles btnLogout.ServerClick
        Session.Abandon()
        Response.Redirect("NotLoggedIn.aspx")
    End Sub

    Protected Sub home(ByVal sender As Object, ByVal e As EventArgs) Handles btnhome.ServerClick
        Response.Redirect("LandingPage.aspx")
    End Sub

End Class